<template>
  <div class="app-container">
    <div class="components-container">
      <fieldset>
        <el-form ref="customerForm" :rules="customer_form_rules" :model="customerForm" label-width="120px"
                 label-position="right">
          <fieldset>
            <legend>基本信息</legend>
            <el-row>
              <el-col :span="6">
                <el-form-item label="客户名称" required prop="customer_name">
                  <el-input
                    v-model="customerForm.customer_name"
                    placeholder="客户名称"
                    maxlength="50"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="客户编码" prop="customer_code">
                  <el-input
                    v-model="customerForm.customer_code"
                    disabled
                    placeholder="自动生成"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="客户状态" prop="customer_status">
                  <el-select v-model="customerForm.customer_status" filterable clearable placeholder="请选择">
                    <el-option
                      v-for="item in option_customer_status"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="客户类型" prop="customer_type">
                  <el-select v-model="customerForm.customer_type" filterable clearable placeholder="请选择">
                    <el-option
                      v-for="item in option_customer_types"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="注册地址" prop="customer_address">
                  <el-input
                    v-model="customerForm.customer_address"
                    placeholder="注册地址"
                    maxlength="100"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="电话" prop="customer_mobile">
                  <el-input
                    v-model="customerForm.customer_mobile"
                    placeholder="电话"
                    maxlength="20"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="传 真" prop="customer_fax">
                  <el-input
                    v-model="customerForm.customer_fax"
                    placeholder="传真"
                    maxlength="20"
                    show-word-limit
                    style="width: 200px"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="客户账户" prop="customer_account">
                  <el-input
                    v-model="customerForm.customer_account"
                    placeholder="客户账户"
                    maxlength="50"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </fieldset>

          <fieldset>
            <legend>法人信息</legend>
            <el-row>
              <el-col :span="6">
                <el-form-item label="法人姓名" prop="legal_name">
                  <el-input
                    v-model="customerForm.legal_name"
                    placeholder="法人姓名"
                    maxlength="10"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="身份证号" prop="legal_id_card">
                  <el-input
                    v-model="customerForm.legal_id_card"
                    placeholder="身份证号"
                    maxlength="20"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="职务" prop="legal_post">
                  <el-input
                    v-model="customerForm.legal_post"
                    placeholder="职务"
                    maxlength="10"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </fieldset>

          <fieldset>
            <legend>开票信息</legend>
            <el-row>
              <el-col :span="6">
                <el-form-item label="开票地址" prop="invoice_address">
                  <el-input
                    v-model="customerForm.invoice_address"
                    placeholder="开票地址"
                    maxlength="10"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="统一社会信用代码" required label-width="150px" prop="unify_social_credit_code">
                  <el-input
                    v-model="customerForm.unify_social_credit_code"
                    placeholder="统一社会信用代码(不允许有空格)"
                    maxlength="30"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="开户行" prop="invoice_bank_deposit">
                  <el-input
                    v-model="customerForm.invoice_bank_deposit"
                    placeholder="开户行"
                    maxlength="10"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="帐号" prop="invoice_bank_account_number">
                  <el-input
                    v-model="customerForm.invoice_bank_account_number"
                    placeholder="帐号"
                    maxlength="10"
                    show-word-limit
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </fieldset>

          <fieldset>
            <legend>控制信息</legend>
            <el-row>
              <el-col :span="6">
                <el-form-item label="客户来源" prop="customer_from_id">
                  <el-select
                    v-model="customerForm.customer_from_id"
                    clearable
                    filterable
                    remote
                    reserve-keyword
                    placeholder="请输入关键词"
                    :remote-method="remoteCustomerComeFrom"
                    @clear="clearCustomerComFrom"
                    style="width: 100%"
                    @change="currentCustomer($event,1)"
                    :loading="loading">
                    <el-option
                      v-for="item in option_customer_come_from"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否共享">
                  <el-select v-model="customerForm.customer_share" filterable clearable placeholder="请选择">
                    <el-option
                      v-for="item in option_YesOrNo"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="客户等级">
                  <el-select v-model="customerForm.customer_level" filterable clearable placeholder="请选择">
                    <el-option
                      v-for="item in option_customer_level"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="客户管理人" prop="customer_account_managers_id">
                  <el-select
                    v-model="customerForm.customer_account_managers_id"
                    filterable
                    :disabled="!(userName==='超级管理员' || userName==='王君')"
                    remote
                    reserve-keyword
                    style="width: 100%"
                    placeholder="请输入关键词"
                    :remote-method="remoteCustomerAccountManagers"
                    @clear="clearCustomerAccountManagers"
                    @change="currentCustomer($event,2)"
                    :loading="loading">
                    <el-option
                      v-for="item in option_customer_managers"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </fieldset>

          <el-row style="text-align: right;">
            <el-button type="primary" size="mini" v-show="(this.loginType===1 && this.isEdit) || !this.isEdit"
                       @click="submitCustomerForm('customerForm')">保存
            </el-button>
          </el-row>
        </el-form>
      </fieldset>
      <fieldset>
        <el-tabs type="border-card" @tab-click="tabsHandleClick">
          <el-tab-pane label="联系人">
            <el-row style="text-align: left;padding: 5px 5px;">
              <el-button type="primary" size="mini" v-show="(this.loginType===1 && this.isEdit) || !this.isEdit" round
                         @click="openCustomerDialog(1)">新建
              </el-button>
            </el-row>
            <el-table :data="contactTableData" :header-cell-style="{background:'#F5F5F5',color:'#000'}" border
                      height="250" style="width: 100%;">
              <el-table-column type="index" :index="computeTableIndex" label="序号" width="100px"/>
              <el-table-column prop="contact_name" label="联系人昵称"/>
              <el-table-column prop="contact_phone" label="联系人方式"/>
              <el-table-column prop="create_date" label="操作时间">
                <template slot-scope="scope">
                  <span>{{ scope.row.create_date | formatSQLDateFormatYMD('yyyy-MM-dd hh:mm:ss') }}</span>
                </template>
              </el-table-column>
            </el-table>
            <el-dialog
              title="客户-联系人记录"
              :visible.sync="dialogCustomerContactFormVisible"
              :close-on-click-modal="false"
              :close-on-press-escape="false"
              :destroy-on-close="true"
              :append-to-body="true"
              @close="dialogCustomerContactFormVisible=false"
            >
              <el-card class="box-card">
                <el-form :model="customerContactForm">
                  <el-form-item label="联系人昵称：">
                    <el-input v-model="customerContactForm.contact_name"/>
                  </el-form-item>
                  <el-form-item label="联系人方式：">
                    <el-input v-model="customerContactForm.contact_phone"/>
                  </el-form-item>
                  <el-form-item style="text-align: right;">
                    <el-button type="primary" @click="saveCustomerContact">保存</el-button>
                  </el-form-item>
                </el-form>
              </el-card>

            </el-dialog>
          </el-tab-pane>
          <el-tab-pane label="事项记录">
            <el-row style="text-align: left;padding: 5px 5px;">
              <el-button type="primary" size="mini" v-show="(this.loginType===1 && this.isEdit) || !this.isEdit" round
                         @click="openCustomerDialog(3)">新建
              </el-button>
            </el-row>
            <el-table :data="eventTableData" :header-cell-style="{background:'#F5F5F5',color:'#000'}" border
                      height="250" style="width: 100%;">
              <el-table-column type="index" :index="computeTableIndex" label="序号" width="100px"/>
              <el-table-column prop="event_content" label="内容">
                <template slot-scope="scope">
                  <el-popover
                    placement="top-start"
                    width="300"
                    trigger="hover"
                    :disabled="scope.row.event_content.length <= 20"
                  >
                    <div>{{ scope.row.event_content }}</div>
                    <span slot="reference"
                          v-if="scope.row.event_content.length <= 20">{{ scope.row.event_content }}</span>
                    <span slot="reference"
                          v-if="scope.row.event_content.length > 20">{{
                        scope.row.event_content.substr(0, 20) + '...'
                      }}</span>
                  </el-popover>
                </template>
              </el-table-column>
              <el-table-column prop="create_date" align="right" label="操作时间" width="150px">
                <template slot-scope="scope">
                  <span>{{ scope.row.create_date | formatSQLDateFormatYMD('yyyy-MM-dd hh:mm:ss') }}</span>
                </template>
              </el-table-column>
            </el-table>
            <el-dialog
              title="客户-事项记录"
              :visible.sync="dialogChangeCustomerEventFormVisible"
              :close-on-click-modal="false"
              :close-on-press-escape="false"
              :destroy-on-close="true"
              :append-to-body="true"
              @close="dialogChangeCustomerEventFormVisible=false"
            >
              <el-card class="box-card">
                <el-form :model="customerEventForm">
                  <el-form-item label="事项内容：">
                    <el-input v-model="customerEventForm.event_content"
                              :rules="[{ required: true, message: '请输入事项内容',trigger:'blur'}]"
                              type="textarea" resize="none"/>
                  </el-form-item>
                  <el-form-item style="text-align: right;">
                    <el-button type="primary" @click="saveCustomerEvent">保存</el-button>
                  </el-form-item>
                </el-form>
              </el-card>
            </el-dialog>
          </el-tab-pane>
          <el-tab-pane label="客户文档">
            <el-row style="text-align: left;padding: 5px 5px;">
              <el-button type="primary" size="mini" v-show="(this.loginType===1 && this.isEdit) || !this.isEdit" round
                         @click="openCustomerDialog(2)">新建
              </el-button>
            </el-row>
            <el-table :data="accessoryTableData" border :header-cell-style="{background:'#F5F5F5',color:'#000'}"
                      height="250" style="width: 100%;">
              <el-table-column type="index" :index="computeTableIndex" label="序号" width="100px"/>
              <el-table-column prop="file_name" label="附件名称"/>
              <el-table-column label="操作">
                <template slot-scope="scope">
                  <a :href="getFileLookUrl(scope.row.file_path)" target="_blank">
                    <span>查看</span>
                  </a>
                  <a size="small" v-down-load="scope.row.file_path+'|'+scope.row.file_name">下载</a>
                </template>
              </el-table-column>
            </el-table>
            <el-dialog
              title="客户-客户文档"
              :visible.sync="dialogChangeCustomerAccessoryFormVisible"
              :close-on-click-modal="false"
              :close-on-press-escape="false"
              :destroy-on-close="true"
              :append-to-body="true"
              @close="dialogChangeCustomerAccessoryFormVisible=false"
            >
              <el-card class="box-card">
                <el-upload
                  ref="upload"
                  action
                  style="display:inline-block"
                  :limit="1"
                  :file-list="fileList"
                  :http-request="uploadFile"
                  :auto-upload="false"
                >
                  <el-button slot="trigger" size="small" type="primary" plain>选取文件</el-button>
                  <el-button
                    style="margin-left: 10px;"
                    size="small"
                    icon="el-icon-upload2"
                    type="success"
                    @click="submitUpload"
                  >导入
                  </el-button>
                </el-upload>
              </el-card>
            </el-dialog>
          </el-tab-pane>
        </el-tabs>
      </fieldset>
    </div>
  </div>
</template>

<style>
fieldset {
  border: 1px solid #e6ebf5;
  margin: 10px 0 10px 0;
}

legend {
  font-size: 13px;
  padding: 0 10px 0 10px;
}

.el-input__inner {
  height: 30px;
  line-height: 30px;
}

.el-tabs--border-card > .el-tabs__content {
  padding: 0;
}

.el-table {
  font-size: 13px;
}

.el-table th, .el-table td {
  padding: 5px 0;
}

.el-form-item__error {
  display: none;
}

.el-form-item {
  margin-bottom: 0;
}

</style>

<script>
import downLoad from '@/down-load-url'
import {
  createCustomer,
  CreateCustomerAccessory,
  CreateCustomerContact,
  CreateCustomerEvent,
  getCustomer, GetCustomerAccessoryList, GetCustomerContactList, GetCustomerEventList
} from '@/api/customer'
import store from '@/store'
import { formatDate } from '@/utils/date'
import { uploadFile } from '@/api/qiniu'

const defaultForm = {
  id: undefined,
  unify_social_credit_code: '', // 统一社会信用代码
  customer_name: '', // 客户姓名
  customer_account: '', //客户账号
  customer_code: '',
  customer_status: 1, // 客户状态
  customer_type: 1, // 客户类型
  customer_address: '', // 客户地址
  customer_mobile: '', // 客户电话
  customer_fax: '', // 客户传真
  legal_name: '', // 法人姓名
  legal_id_card: '', // 法人身份证号
  legal_post: '', // 法人职务
  invoice_address: '', // 发票地址
  invoice_bank_deposit: '', // 开户行
  invoice_bank_account_number: '', // 发票信息账号
  customer_from: '', // 客户来源
  customer_share: 0, // 客户是否分享
  customer_level: 1, // 客户等级
  customer_is_subsidize: 0, // 客户是否被当地资助
  customer_account_managers: '', // 客户管理人
  create_date: '' // 客户创建时间
}
export default {
  name: 'CustomerDetail',
  props: {
    isEdit: {
      type: Boolean,
      default: false
    }
  },
  directives: { downLoad },
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'info',
        deleted: 'danger'
      }
      return statusMap[status]
    },
    formatDate(time) {
      time = time * 1000
      const date = new Date(time)
      return formatDate(date, 'yyyy-MM-dd')
    },
    formatDateFormatYMD(time) {
      const date = new Date(time)
      return formatDate(date, 'yyyy-MM-dd')
    },
    formatSQLDateFormatYMD(time, formatStr) {
      const date = new Date(time * 1000)
      return formatDate(date, formatStr)
    }
  },
  data() {
    return {
      loginType: store.getters.loginType,
      customer_id: 0,
      userName: '',
      activeName: 'first',
      customerForm: Object.assign({}, defaultForm),
      loading: false,
      option_customer_status: [
        { value: 1, label: '潜在' },
        { value: 2, label: '目标' },
        { value: 3, label: '立项' },
        { value: 4, label: '关怀' },
        { value: 5, label: '签约' },
        { value: 6, label: '谈判' },
        { value: 7, label: '价值' }],
      option_customer_types: [{ value: 1, label: '客户' }, { value: 2, label: '当事人' }],
      option_YesOrNo: [{ value: 1, label: '是' }, { value: 0, label: '否' }],
      option_customer_managers: [],
      option_customer_come_from: [],
      option_customer_manager_list: [
        { value: 2, label: '王君' },
        { value: 3, label: '闫露露' },
        { value: 4, label: '王国禹' },
        { value: 5, label: '范艳良' },
        { value: 1, label: '超级管理员' }],
      option_customer_level: [
        { value: 1, label: '立案客户' },
        { value: 2, label: '高级客户' },
        { value: 3, label: '中级客户' },
        { value: 4, label: '低级客户' }],
      timeNow: new Date(),
      tempRoute: {},
      customer_form_rules: {
        customer_name: [
          { required: true, message: '请输入客户名称', trigger: 'blur' },
          { min: 1, max: 50, message: '长度在 1 到 50 个字符', trigger: 'blur' }
        ],
        unify_social_credit_code: [
          { required: true, message: '请输入统一社会信用代码', trigger: 'blur' },
          { min: 1, max: 30, message: '长度在 1 到 30 个字符', trigger: 'blur' }
        ]
      },
      contactTableData: [],
      eventTableData: [],
      accessoryTableData: [],
      dialogCustomerContactFormVisible: false,
      dialogChangeCustomerEventFormVisible: false,
      dialogChangeCustomerAccessoryFormVisible: false,
      customerContactForm: {
        contact_name: '',
        contact_phone: ''
      },
      customerEventForm: {
        event_content: ''
      },
      fileList: []
    }
  },
  created() {
    if (this.isEdit) {
      const customerId = this.$route.params && this.$route.params.customerId
      this.fetchData(customerId)
    }
    this.tempRoute = Object.assign({}, this.$route)
    this.userName = store.getters.userName
  },
  methods: {
    getFileLookUrl(imgPath) {
      return 'http://www.wzjip.cn:1180/api/preview?previewUrl=' + encodeURIComponent(imgPath)
    },
    checkPicture(imgPath) {
      //判断是否是图片 - strFilter必须是小写列举
      const strFilter = '.jpeg|.gif|.jpg|.png|.bmp|.pic|.svg|'
      if (imgPath.indexOf('.') > -1) {
        const p = imgPath.lastIndexOf('.')
        let strPostfix = imgPath.substring(p, this.length) + '|'
        strPostfix = strPostfix.toLowerCase()
        if (strFilter.indexOf(strPostfix) > -1) {
          return true
        }
      }
      return false
    },
    openCustomerDialog(objType) {
      if (objType === 1) {
        this.dialogCustomerContactFormVisible = true
        this.getContactList()
      } else if (objType === 2) {
        this.dialogChangeCustomerAccessoryFormVisible = true
        this.getAccessoryList()
      } else if (objType === 3) {
        this.dialogChangeCustomerEventFormVisible = true
        this.getEventList()
      }
    },
    computeTableIndex(index) {
      return index + 1
    },
    tabsHandleClick(tab, event) {
      if (tab.index === '0') {
        this.getContactList()
      } else if (tab.index === '1') {
        this.getEventList()
      } else if (tab.index === '2') {
        this.getAccessoryList()
      }
    },
    fetchData(customerId) {
      getCustomer(customerId).then(response => {
        this.customerForm = response.data
        this.customerForm.customer_from_id = response.data.customer_from_id
        this.customerForm.customer_account_managers_id = response.data.customer_account_managers_id
        this.option_customer_managers = [{
          value: this.customerForm.customer_account_managers_id,
          label: this.customerForm.customer_account_managers
        }]
        this.option_customer_come_from = [{
          value: this.customerForm.customer_from_id,
          label: this.customerForm.customer_from
        }]

        this.customer_id = customerId //赋值
        this.setTagsViewTitle()
        this.getContactList()
      }).catch(err => {
        console.log(err)
      })
    },
    setTagsViewTitle() {
      const title = '编辑客户'
      const route = Object.assign({}, this.tempRoute, { title: `${title}` })
      this.$store.dispatch('tagsView/updateVisitedView', route)
      document.title = `${title}`
    },
    submitCustomerForm() {
      let message = '客户创建成功'
      if (this.isEdit) {
        message = '客户更新成功'
      }
      console.log(this.customerForm)
      this.loading = true
      createCustomer(this.customerForm).then(res => {
        this.loading = false
        console.log(res)
        this.$notify({
          title: '成功',
          message: message,
          type: 'success',
          duration: 2000
        })
        this.$router.push('/customer/list')
      })
      this.loading = false
    },
    getContactList() {
      const that = this
      if (that.customer_id === 0 || that.customer_id === undefined) {
        that.$message.error('请先创建客户信息')
        return
      }
      GetCustomerContactList(that.customer_id).then(response => {
        that.contactTableData = response.data
      }).catch(() => {
        that.contactTableData = []
      })
    },
    getAccessoryList() {
      const that = this
      if (that.customer_id === 0 || that.customer_id === undefined) {
        that.$message.error('请先创建客户信息')
        return
      }
      GetCustomerAccessoryList(that.customer_id).then(response => {
        that.accessoryTableData = response.data
      }).catch(() => {
        that.accessoryTableData = []
      })
    },
    getEventList() {
      const that = this
      if (that.customer_id === 0 || that.customer_id === undefined) {
        that.$message.error('请先创建客户信息')
        return
      }
      GetCustomerEventList(that.customer_id).then(response => {
        that.eventTableData = response.data
      }).catch(() => {
        that.eventTableData = []
      })
    },
    saveCustomerContact() {
      const dataParam = {
        customer_id: parseInt(this.customer_id),
        contact_name: this.customerContactForm.contact_name,
        contact_phone: this.customerContactForm.contact_phone
      }
      CreateCustomerContact(dataParam).then(res => {
        this.loading = false
        this.$notify({
          title: '成功',
          message: res.message || '更新成功',
          type: 'success',
          duration: 2000
        })
        this.getContactList()
        this.customerContactForm.contact_name = ''
        this.customerContactForm.contact_phone = ''
      })
      this.dialogCustomerContactFormVisible = true
    },
    saveCustomerEvent() {
      const dataParam = {
        customer_id: parseInt(this.customer_id),
        event_content: this.customerEventForm.event_content
      }
      CreateCustomerEvent(dataParam).then(res => {
        this.loading = false
        this.$notify({
          title: '成功',
          message: res.message || '更新成功',
          type: 'success',
          duration: 2000
        })
        this.getEventList()
        this.customerEventForm.event_content = ''
      })
      this.dialogchangeCustomerEventFormVisible = true
    },
    submitUpload() {
      this.$refs.upload.submit()
    },
    uploadFile(fileObj) {
      const that = this
      const formData = new FormData()
      formData.set('file', fileObj.file)
      uploadFile(formData, {
        headers: {
          'Content-type': 'multipart/form-data'
        }
      }).then(res => {
          const dataParam = {
            customer_id: parseInt(this.customer_id),
            file_id: parseInt(res.data)
          }
          CreateCustomerAccessory(dataParam).then(res => {
            that.loading = false
            that.$notify({
              title: '成功',
              message: res.message || '更新成功',
              type: 'success',
              duration: 2000
            })
            that.getAccessoryList()
          })
          that.dialogChangeContractAccessoryFormVisible = false
        }
      ).catch(err => {
        console.log(err)
      })
    },
    remoteCustomerAccountManagers(query) {
      if (query !== '') {
        this.loading = true
        setTimeout(() => {
          this.loading = false
          this.option_customer_managers = this.option_customer_manager_list.filter(item => {
            return item.label.toLowerCase()
              .indexOf(query.toLowerCase()) > -1
          })
        }, 200)
      } else {
        this.option_customer_managers = []
      }
    },
    clearCustomerAccountManagers() {
      this.option_customer_managers = []
    },
    remoteCustomerComeFrom(query) {
      if (query !== '') {
        this.loading = true
        setTimeout(() => {
          this.loading = false
          this.option_customer_come_from = this.option_customer_manager_list.filter(item => {
            return item.label.toLowerCase()
              .indexOf(query.toLowerCase()) > -1
          })
        }, 200)
      } else {
        this.option_customer_managers = []
      }
    },
    clearCustomerComFrom() {
      this.option_customer_come_from = []
    },
    currentCustomer(value, type) {
      switch (type) {
        case 1:
          this.option_customer_come_from.find((item) => {
            if (item.value === value) {
              this.customerForm.customer_from = ''
              this.customerForm.customer_from = item.label
            }
          })
          return
        case 2:
          this.option_customer_managers.find((item) => {
            if (item.value === value) {
              this.customerForm.customer_account_managers = ''
              this.customerForm.customer_account_managers = item.label
            }
          })
          return
      }
    }
  }
}
</script>
